package com.ztsoft.user.config.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * Swagger配置类
 */
@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo())
                .select()
                // 过滤条件，扫描指定路径下的文件
                .apis(RequestHandlerSelectors.basePackage("com.ztsoft.user.dynamic.controller").or(RequestHandlerSelectors.basePackage("com.ztsoft.user.controller")))
                // .apis(RequestHandlerSelectors.basePackage("com.ztsoft.user.controller"))
                .build();
    }

    /**
     * swagger3 访问地址
     * http://ip:port/swagger-ui/index.html
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("匹配系统管理平台")
                .description("匹配系统管理平台 API接口文档")
                .license("南昌众投科技")
                .version("V1.0")
                .build();
    }

}